#ifndef _CLINEPLOT_H_
#define _CLINEPLOT_H_

#include <buola/chart/plots/cxyplot.h>
#include <buola/chart/cseries.h>

#include <vector>
#include <set>

namespace buola { namespace chart {

class CLinePlot : public CXYPlot
{
    struct SPoint
    {
        int i;
        CPoint_d mData;
        CPoint_d mPoint;
    };

public:
    CLinePlot();
    virtual ~CLinePlot();

public:
/////////////// interface /////////////////
    void SetSeries(PSeries pSeries);

    void SetColor(const img::CColor &pColor);

    void SetLineWidth(double pWidth);
    void SetLineColor(const img::CColor &pColor);
    void SetPointDiameter(double pDiameter);
    void SetPointShape(ePointShape pShape);
    void SetPointColor(const img::CColor &pColor);
    void SetPointFillColor(const img::CColor &pColor);
    void SetFillColor(const img::CColor &pColor);

    virtual const std::wstring &GetName()   {   return mSeries->mName;  }
    virtual void SetName(const std::wstring &pName);
    virtual img::CColor GetColor()           {   return mLineColor;  }

    virtual double GetMinX()    {   return mSeries->mMin.x; }
    virtual double GetMinPosX() {   return mSeries->mMinPos.x;  }
    virtual double GetMaxX()    {   return mSeries->mMax.x; }
    virtual double GetMinY()    {   return mSeries->mMin.y; }
    virtual double GetMinPosY() {   return mSeries->mMinPos.y;  }
    virtual double GetMaxY()    {   return mSeries->mMax.y; }

    void ClearDontSkipList();
    void AddToDontSkipList(int i);

    virtual void Draw(CXYChartContext &pC);
    virtual void DrawHover(CXYChartContext &pC,const CPoint_d &pPos);
    virtual double GetDist(const CPoint_d &pPos,CXAxis *pXAxis,CYAxis *pYAxis);
    virtual CPoint_d GetNearestPoint(const CPoint_d &pPos,CXAxis *pXAxis,CYAxis *pYAxis);

    //!used to implement CErrorPlot
    virtual void DrawComplements(CXYChartContext &pC)   {}
protected:
/////////////////// properties ////////////////////
    PSeries mSeries;

    img::CColor mLineColor;
    double mLineWidth;
    img::CColor mPointColor;
    img::CColor mPointFillColor;
    double mPointDiameter;
    ePointShape mPointShape;
    img::CColor mFillColor;

    int mNearestPoint;

    std::vector<SPoint> mPoints;

    std::set<int> mDontSkipList;
};

/*namespace chart*/ } /*namespace buola*/ }

#endif
